package com.china.produce.config.rabbitmq;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName
 * @Author niujie
 * @Version
 * @Description
 * @CreateTime 2022/1/17
 */

@Configuration
public class DirectConfig {

    @Bean
    public Queue smsDirectQueue()
    {
        return new Queue("sms.direct", true);
    }

    @Bean
    public DirectExchange directExchange()
    {
        return new DirectExchange("dead_direct_exchange", true, false);
    }


    @Bean
    public Binding bindSmsQueue()
    {
        return BindingBuilder.bind(smsDirectQueue()).to(directExchange()).with("sms");
    }
}

